package com.demo.excel;

import cc.winfo.core.utils.DateUtil;

import java.util.Date;

/**
 * @ClassName CustomField
 * @Description TODO
 * @Author zqc
 * @Date 2020/9/8 16:37
 * @Version 1.0
 */
public interface CustomField {

    /**
     * @param value  属性值
     * @param method 方法名称
     * @return
     */
    String accept(Object value, String method);


    static String defaultAccept(Object value) {
        if (value == null) return "";
        if (value instanceof Date) return DateUtil.dateTime((Date) value);

        return value.toString();
    }

    static String acceptDate(Object value) {
        if (value == null) return "";
        if (value instanceof Date) return DateUtil.date((Date) value);

        return value.toString();
    }
}
